"""Main entry point for survey generation."""
import typer
from pathlib import Path
from typing import Optional

from generator import generator
from config import OUTPUT_DIR

app = typer.Typer()

@app.command()
def generate(
    topic: str = typer.Option("Aspect Based Sentiment Analysis", help="Topic of the survey"),
    sections: int = typer.Option(5, help="Number of main sections"),
    min_words: int = typer.Option(500, help="Minimum words per subsection"),
    output_dir: Optional[Path] = typer.Option(OUTPUT_DIR, help="Output directory"),
    enhance_coherence: bool = typer.Option(True, help="Whether to enhance coherence between sections")
):

    """Generate an academic survey on the given topic."""
    # Generate outline
    typer.echo(f"Generating outline for topic: {topic}")
    outline = generator.generate_outline(topic, sections)
    
    # Generate content
    typer.echo("Generating content for each subsection")
    survey = generator.generate_content(topic, outline, min_words)
    
    # Enhance coherence if requested
    # if enhance_coherence:
    #     typer.echo("Enhancing coherence between sections")
    #     survey = generator.enhance_coherence(survey)
    
    # Save survey
    # output_path = generator.save_survey(survey, output_dir)
    # typer.echo(f"Survey saved to: {output_path}")
    typer.echo(f"Survey saved to output dir")
    
if __name__ == "__main__":
    app() 